﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SGTD.Entidades;
using System.Data.SqlClient;

namespace SGTD.DAO
{
    public class clsTurnoDAO
    {
        public List<clsTurno> listarTurno()
        {
            SqlConnection conexion = clsConexion.ObtenerConexion();
            SqlCommand cmd = new SqlCommand("listar_turno_pa", conexion);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            SqlDataReader dr = cmd.ExecuteReader();

            List<clsTurno> lista = new List<clsTurno>();
            clsTurno t = null;

            while (dr.Read())
            {
                t = new clsTurno();
                t.IdTurno = Convert.ToInt32(dr["IdTurno"]);
                t.Nombre = Convert.ToString(dr["Nombre"]);
                lista.Add(t);
            }
            conexion.Close();
            return lista;
        }
    }
}
